<?php

if(isset($_POST['filIdEdit']) && isset($UID)){
#if it is a dirAdd request

  $filIdEdit   = $_POST['filIdEdit'];

  require_once $BASE_PATH . 'm/fil.php';

  $filcn = new FIL(DBHOST, DBUSER, DBPASS, DBNAME);

  $filEdit = $filcn->getById($filIdEdit);

  require_once $BASE_PATH . 'm/dir.php';

  $dircn = new DIR(DBHOST, DBUSER, DBPASS, DBNAME);

  $filParent = $dircn->getById($filEdit['parent']);

  $dircn->alt($filParent['id'], $filParent['parent'], $filParent['name'], $filParent['subdir'], $filParent['file'] - 1, $filParent['uid']);

  $filcn->delById($filIdEdit);

  require_once $BASE_PATH . 'm/bookmark.php';
  $bmcn = new Bookmark(DBHOST, DBUSER, DBPASS, DBNAME);
  $bookmark = $bmcn->get($UID);

  echo '{"code": 0, "data":' . json_encode($bookmark) . '}';
}
